package com.htthorizon.system.controller;

/**
 * @author Brilliant
 */

import com.htthorizon.common.core.domain.R;
import com.htthorizon.system.api.domain.MonitorAll;
import com.htthorizon.system.monitor.*;
import com.htthorizon.system.service.IMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/monitor")
public class MonitorController {

    @Autowired
    private IMonitorService monitorService;

    @GetMapping("/all")
    public R<MonitorAll> all(){
        BusinessSystemOnlineNum businessSystemOnlineNum = monitorService.getBusinessSystemOnlineNum();
        BusinessUserRegNum businessUserRegNum = monitorService.getBusinessUserRegNum();
        BusinessVisitCount businessVisitCount = monitorService.getBusinessVisitCount();
        BusinessSystemResponseTime businessSystemResponseTime = monitorService.getBusinessSystemResponseTime();
        BusinessSystemDBTime businessSystemDBTime = monitorService.getBusinessSystemDBTime();
        BusinessSystemRunningTime businessSystemRunningTime = monitorService.getBusinessSystemRunningTime();
        BusinessDataTableSpace businessDataTableSpace = monitorService.getBusinessDataTableSpace();
        BusinessDayLoginNum businessDayLoginNum = monitorService.getBusinessDayLoginNum();


        MonitorAll monitorAll = new MonitorAll();
        monitorAll.setBusinessSystemDBTime(businessSystemDBTime.getBusinessSystemDBTime());
        monitorAll.setBusinessDayLoginNum(businessDayLoginNum.getBusinessDayLoginNum());
        monitorAll.setBusinessDataTableSpace(businessDataTableSpace.getBusinessDataTableSpace());
        monitorAll.setBusinessSystemOnlineNum(businessSystemOnlineNum.getBusinessSystemOnlineNum());
        monitorAll.setBusinessSystemRunningTime(businessSystemRunningTime.getBusinessSystemRunningTime());
        monitorAll.setBusinessSystemResponseTime(businessSystemResponseTime.getBusinessSystemResponseTime());
        monitorAll.setBusinessVisitCount(businessVisitCount.getBusinessVisitCount());
        monitorAll.setBusinessUserRegNum(businessUserRegNum.getBusinessUserRegNum());
        monitorAll.setBusinessSystemSessionNum(businessSystemOnlineNum.getBusinessSystemOnlineNum());

        return R.ok(monitorAll);
    }

    @GetMapping("/getBusinessSystemOnlineNum")
    public R<BusinessSystemOnlineNum> getBusinessSystemOnlineNum(){
        BusinessSystemOnlineNum result=  monitorService.getBusinessSystemOnlineNum();
        return R.ok(result);
    }

    @GetMapping("/getBusinessUserRegNum")
    public R<BusinessUserRegNum> getBusinessUserRegNum(){
        BusinessUserRegNum result=  monitorService.getBusinessUserRegNum();
        return R.ok(result);
    }

    @GetMapping("/getBusinessVisitCount")
    public R<BusinessVisitCount> getBusinessVisitCount(){
        BusinessVisitCount result=   monitorService.getBusinessVisitCount();
        return R.ok(result);
    }

    @GetMapping("/getBusinessSystemResponseTime")
    public R<BusinessSystemResponseTime> getBusinessSystemResponseTime(){
        BusinessSystemResponseTime result=  monitorService.getBusinessSystemResponseTime();
        return R.ok(result);
    }

    @GetMapping("/getBusinessSystemDBTime")
    public R<BusinessSystemDBTime> getBusinessSystemDBTime(){
        BusinessSystemDBTime result=  monitorService.getBusinessSystemDBTime();
        return R.ok(result);
    }

    @GetMapping("/getBusinessSystemRunningTime")
    public R<BusinessSystemRunningTime> getBusinessSystemRunningTime(){
        BusinessSystemRunningTime result=  monitorService.getBusinessSystemRunningTime();
        return R.ok(result);
    }

    @GetMapping("/getBusinessDataTableSpace")
    public R<BusinessDataTableSpace> getBusinessDataTableSpace(){
        BusinessDataTableSpace result=   monitorService.getBusinessDataTableSpace();
        return R.ok(result);
    }

    @GetMapping("/getBusinessDayLoginNum")
    public R<BusinessDayLoginNum> getBusinessDayLoginNum(){
        BusinessDayLoginNum result=   monitorService.getBusinessDayLoginNum();
        return R.ok(result);
    }

    @GetMapping("/getBusinessSystemSessionNum")
    public R<BusinessSystemSessionNum> getBusinessSystemSessionNum(){
        BusinessDayLoginNum result=   monitorService.getBusinessDayLoginNum();
        BusinessSystemSessionNum businessSystemSessionNum = new BusinessSystemSessionNum();
        businessSystemSessionNum.setBusinessSystemSessionNum(result.getBusinessDayLoginNum());
        return R.ok(businessSystemSessionNum);
    }



}
